
/* util */
import Log from '@src/util/log'

function setTimeoutError<T extends any>(millisecond: number, promise: Promise<T>): Promise<T> {
  return new Promise<T>((resolve, reject) => {
    
    promise.then(resolve).catch(reject);
    
    setTimeout(() => {
      
      Log.info(promise, setTimeoutError.name);
      
      reject(new Error(setTimeoutError.name));
      
    }, millisecond);
    
  });
}

export {
  setTimeoutError
};

export default {
  setTimeoutError
};

